package cn.com.api.mapper.base;

import java.util.List;

import org.apache.ibatis.annotations.*;

import cn.com.api.entity.ApiT_address;

//DAO
public interface T_addressMapperBase {

	// 根据id查看
	@Select("SELECT * FROM T_ADDRESS  WHERE ID = #{id}")
	public ApiT_address findT_addressById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM T_address")
	public List<ApiT_address> findT_addresss();

	// 添加
	@Insert("INSERT INTO T_ADDRESS (U_ID, PROVINCE, CITY, COUNTY, ADDRESS, LONGITUDE, LATITUDE, PHONE, NAME, ENABLE,zipcode,is_default) VALUES (#{u_id,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{county,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{enable,jdbcType=INTEGER}, #{zipcode,jdbcType=VARCHAR}, #{is_default,jdbcType=INTEGER})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertT_address(ApiT_address t_address);

	// 修改
	@Update("UPDATE T_ADDRESS SET  PROVINCE = #{province,jdbcType=VARCHAR}, CITY = #{city,jdbcType=VARCHAR}, COUNTY = #{county,jdbcType=VARCHAR}, ADDRESS = #{address,jdbcType=VARCHAR}, LONGITUDE = #{longitude,jdbcType=VARCHAR}, LATITUDE = #{latitude,jdbcType=VARCHAR}, PHONE = #{phone,jdbcType=VARCHAR}, NAME = #{name,jdbcType=VARCHAR} WHERE ID = #{id}")
	public int updateT_address(ApiT_address t_address);

	// 删除
	@Delete("DELETE FROM T_ADDRESS  WHERE ID = #{ID}")
	public int deleteT_address(Integer id);

	// Foreign keys revelant

	// region Indexs revelant

}
